package com.hq.util;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class MyAOP {

    @Pointcut("execution(*  com.hq.service.*.*(..))")
    private void myPC(){

    }

    @Around("myPC()")
    public Object around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        long l1 = System.currentTimeMillis();
        Object proceed = proceedingJoinPoint.proceed();
        long l2 = System.currentTimeMillis();
        System.out.println("耗时："+(l2-l1));

        return proceed;
    }
}
